$(function(){
    var contentTitle = '<div class="col-md-12 page">'
	    + '<div class="col-md-12 title">'
            + '</div>'
	    + '</div>';

    var content = '<div class="row col-md-4 content-space">'
    	    + '<a id="{id}" class="comp" href="#" ref="{url}"><div class="row col-md-12">'
	    + '<div class="col-md-6 contentLogo">'
	    + '<img src="/'+contextPath+'/dacp-res/dacpstore/images/u335.png" alt=""/>'
	    + '</div>'
	    + '<div class="col-md-6 contentLabel">'
	    + '<h5>${label}</h5>'
	    + '<p>${prodtype}</p>'
	    + '</div>'
    	    + '</div>'
            + '<div class="row col-md-12">'
	    + '<div class="col-md-6">'
	    + '<img src="/'+contextPath+'/dacp-res/dacpstore/images/u83.png" class="img-style"/>'
    	    + '</div>'
	    + '<div class="col-md-6 user-font user-space">'
	    + '56777人使用'
    	    + '</div>'
            + '</div>'
	    + '<div class="col-md-12">'
	    + '&nbsp;&nbsp;<button type="button" class="btn btn-btn-info btn-xs">详细</button>'
	    + '&nbsp;&nbsp;<button type="button" class="btn btn-btn-info btn-xs">运行</button>'
	    + '&nbsp;&nbsp;<button type="button" class="btn btn-btn-info btn-xs">开发</button>'
	    + '</div>'
        + '</div></a>';
    var titles = ["管理类","服务类","处理类","基础框架"];
 
itemmgr=[
  {id:'meta',name:'元数据管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=meta',parent:'数据管理'},
  {id:'lcmgr',name:'生命周期管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=lcmgr',parent:'数据管理'},
  {id:'DAG-DQ',name:'数据质量',url:'ftl/me/metaframe/ai.meta.frame?modelcode=DAG-DQ',parent:'数据管理'},
  {id:'arimgr',name:'架构管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=arimgr',parent:'数据管理'},
  {id:'secdata',name:'安全管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=secdata',parent:'数据管理'},
  {id:'stdmgr',name:'标准化管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=stdmgr',parent:'数据管理'}
];		 
itemservice=[
  {id:'metaindex',name:'元模型目录',url:'ftl/me/metaframe/ai.meta.frame?loadtype=metaindex'},
  {id:'dataindex',name:'数据资源目录',url:'html/dataindex/index.html'},
  {id:'dataasert',name:'数据资产目录',url:'ftl/me/metaframe/ai.meta.frame?modelcode=DAG-DQ'},
  {id:'dataserveindex',name:'数据服务目录',url:'ftl/me/metaframe/ai.meta.frame?modelcode=arimgr'},
  {id:'DATAVIZ',name:'数据资产视图',url:'html/dataviz/home1.html?opener=window'},
  {id:'DATAHELTH',name:'数据健康体检',url:'html/datahelth/总体评价new.html'}
];
itemdp=[
  {id:'dp-taskMgr',name:'调度平台',url:'ftl/me/metaframe/ai.meta.frame?modelcode=meta'},
  {id:'dp-inger',name:'数据采集平台',url:'ftl/daas/etl/extractList' },
  {id:'dp-excuter',name:'数据加工平台',url:'ftl/me/metaframe/ai.meta.frame?loadtype=paas'},
  {id:'dp-send',name:'数据分发平台',url:'ftl/me/metaframe/ai.meta.frame?modelcode=arimgr',parent:'数据管理'},
  {id:'dp-stream',name:'实时流处理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=secdata',parent:'数据管理'},
  {id:'dp-monite',name:'运维监控平台',url:'ftl/me/metaframe/ai.meta.frame?modelcode=DPS-MONITE'}
];
itembase=[
  {id:'dataportal',name:'数据门户',url:'http://localhost:7070/me/ftl/me/portal/index?opener=window' },
  {id:'sysmgr',name:'系统管理',url:'ftl/me/metaframe/ai.meta.frame?modelcode=sysmgr' },
  {id:'flowMgr',name:'任务流程中心',url:'ftl/me/metaframe/ai.meta.frame?modelcode=flowMgr'},
  {id:'helper',name:'帮助中心',url:'ftl/me/metaframe/ai.meta.frame?modelcode=flowMgr'},
  {id:'apigate',name:'API网关',url:'ftl/me/metaframe/ai.meta.frame?modelcode=secdata',parent:'数据管理'},
  {id:'dps-control',name:'控制中心',url:'html/dpsconsole/logmonitoring.html?opener=window',parent:'数据管理'}
];		
var items=[];
items.push(itemmgr);
items.push(itemservice);
items.push(itemdp);
items.push(itembase);	
    var labels = [
    ["数据质量管理","生命周期管理","元数据管理","标准化管理","数据评估","安全管理","架构管理"],
    ["元模型目录","数据资源目录","数据服务目录","数据资产目录","API网关","数据网关"],
    ["统计分析","影响分析","血缘分析"],["数据处理","看数据","产品项目管理"],
    ["数据门户","系统管理","帮助中心","工作流程","控制中心","API服务"]
    ];
    for(var i = 0; i< titles.length;i++){
	$("#leftContent").append(contentTitle);
	var title = $("#leftContent .title").eq(i);
	title.html(titles[i]);
	var itemComps=items[i];
	for(var k = 0; k < itemComps.length ; k++){
	 	var comp=itemComps[k];
	    //title.parent().append(content.replace("${label}",labels[i][k]+"<p class='user-font'>"+titles[i].substring(0,2)+"</p>"));
	    var html= content.replace("${label}",comp.name).replace("${prodtype}",""+titles[i].substring(0,2)+"");
	    html=html.replace("{url}",comp.url);
	    html=html.replace("{id",comp.id);
	    
	    title.parent().append(html  );
	}
    }

    $("#footer .col-md-6").hover(function(){
	$(this).css("color","#ffffff");
    },function(){
	$(this).css("color","#cdcdcd");
    });

    $(".banner-label").hover(function(){
	$(this).css("box-shadow","5px 5px 5px 5px #cdcdcd");
    },function(){
	$(this).css("box-shadow","none");
    });
    
   $(".col-md-7 .banner-label a").click(function(){
   	  var _url=$(this).attr("ref");
   	    if(!_url){alert('没有配置地址,错误');return;};
   	    var title = ($(this).find("p").html());
   	  
   	    if(_url.indexOf("opener=window")>0 && _url.indexOf("http")<0){
   	    	window.open("/"+contextPath+"/"+_url);
   	    }else if(_url.indexOf("opener=window")>0 && _url.indexOf("http")>=0){
   	    	window.open(_url);
   	    }else{
		   ai.addTabSheet($(this).attr("id"),title, _url,true)
		 };
		}); 
	   $(".content-space  a").click(function(){
   	  var _url=$(this).attr("ref");
   	    if(!_url){alert('没有配置地址,错误');return;};
   	    var title = ($(this).find(".contentLabel h5").html());
   	  
   	    if(_url.indexOf("opener=window")>0 && _url.indexOf("http")<0){
   	    	window.open("/"+contextPath+"/"+_url);
   	    }else if(_url.indexOf("opener=window")>0 && _url.indexOf("http")>=0){
   	    	window.open(_url);
   	    }else{
   	    	_url="/"+contextPath+"/"+_url;
   	    	var indexurl="/"+contextPath+"/ftl/me/dataos/index?title="+title+"&firstpage=";
   	    	indexurl+=encodeURIComponent(_url);
			 window.open(indexurl); 
		  // ai.addTabSheet($(this).attr("id"),title, _url,true)
		 };
		}); 
  	 
});
